package com.zjj.learn.designmodel.pattern.factory.simple_factory;

/**  简单工厂模式
 * *** @author zjj_admin
 * *** 2022/4/5 20:06
 */
public class SimpleCoffeeFactory {

    public Coffee createCoffee(String type){
        Coffee coffee = null;
        if(type.equals("america")){
            coffee = new AmericaCoffee();
        }else if(type.equals("latte")){
            coffee = new LatteCoffee();
        }else {
            throw new RuntimeException("咖啡种类不存在");
        }
        return coffee;
    }
}
